#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int get_prefix_result(string str1, string str2);

int main(int argc, char const* argv[])
{
    int n;
    vector<string> data;
    cin >> n;
    for (int i = 0; i < n; i++) {
        string str;
        cin >> str;
        data.push_back(str);
    }
    int result = data[0].size();
    for (int i = 0; i < data.size() - 1; i++) {
        string string1 = data[i];
        string string2 = data[i + 1];
        result += get_prefix_result(string1, string2);
    }
    printf("%d\n", result);
    return 0;
}

int get_prefix_result(string str1, string str2)
{
    int length1 = str1.size();
    int length2 = str2.size();
    int min_length;

    if (length1 >= length2) {
        min_length = length2;
    } else {
        min_length = length1;
    }
    int result = 0;
    int i = 0;
    for (i = 0; i < min_length; i++) {
        if (str1[i] != str2[i]) {
            break;
        }
    }
    result = length2 - i + 1;
    return result;
}